home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-05-08 | 583 b | 29 lines |
- class B {
- public static void main(String[] args) {
- B b = new B();
- b.test(args);
- }
-
- void test(String[] args) {
- String s;
-
- if (args.length == 0)
- s = new String("don't throw");
- else
- s = args[0];
-
- try {
- method(s);
- System.out.println("no exception");
- } catch (MyException e) {
- System.out.println("caught");
- }
- }
- void method(String s) throws MyException {
- if (s.equals("throw"))
- throw new MyException();
- else
- return;
- }
- }
-